﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/AdminSite.Master" Inherits="System.Web.Mvc.ViewPage<MensUnoShop.Models.NormalMarket>" ValidateRequest="false" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	MarketPictureDetail
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<div id="main-content" class="hastable">
	<div class="title title-spacing">
		<h2>圖說列表</h2>
					
	</div>
        
    <input type="button" value="賣場列表" onclick="location.href='/Admin/Product/MarketList'" />
    <input type="button" value="賣場明細" onclick="location.href='/Admin/Product/Market/<%:Model.MKGUID %>'" />

    <%using (Html.BeginForm("../Product/MarketPictureDetail", "Product", FormMethod.Post, new { @class = "shBox", enctype = "multipart/form-data" }))
    {%>
        <%:Html.Hidden("Act", TempData["action"])%>
        <%:Html.Hidden("MPid", TempData["MPid"])%>
        <%:Html.Hidden("MPmkguid", TempData["MPmkguid"])%>
    <table cellspacing="0" style="width:700px;">
            <tr>            
			    <th>賣場圖</th>
			    <td style="text-align: left" align="left" valign="middle">
                    <%var p = TempData["MPpic"] as string;
                      if (!string.IsNullOrEmpty(p))
                      { %>
                    <img id="MPpic" src="<%=p%>" />
                    <%} %>
                    <input type="file" id="uppic" name="uppic" />
                </td>
		    </tr>
            <tr>            
			    <th >說明文字</th>
			    <td  style="text-align: left" align="left" valign="middle" colspan="2"><%:Html.TextBox("MPnote", TempData["MPnote"], new {size="80" })%></td>
                
		    </tr> 
            <tr>            
			    <th >順序</th>
			    <td  style="text-align: left" align="left" valign="middle" colspan="2"><%:Html.TextBox("MPsequence", TempData["MPsequence"]??0, new { size = "10" })%></td>
		    </tr>                
            <tr>
			    <td colspan="3"><input type="submit" class="submit" value="<%:TempData["bmsg"] %>" /></td>
                
		    </tr>
    </table>  
    <%} %>

    <table cellspacing="0" style="width:700px;">
        <thead>
			<tr>					
				<td style="width:150px">圖片</td>
                <td style="width:460px">說明</td>
                <td style="width:50px">順序</td>
                <td style="width:40px"></td>
			</tr>
		</thead>
        <%if (Model != null){%>
        <tbody>
            <%foreach (var item in Model.MARKETIMG)
            {%>
        	    <tr>                    
                    <td align="center" style="text-align: center" valign="middle"><a href="<%:item.PATH %>" target="_blank" title="點選看大圖"><img src="<%:item.PATH %>" /></a></td>
                    <td align="center" style="text-align: center" valign="middle"><%:item.TITLE %></td>
                    <td align="center" style="text-align: center" valign="middle"><%:item.SEQUENCE%></td>
                    <td>
                    <%using (Html.BeginForm("../Product/MarketPictureDetail", "Product", FormMethod.Post, new { @style = "display:inline", enctype = "multipart/form-data" }))
                    {%>
                    <%:Html.Hidden("Act", "Upt")%>
                    <%:Html.Hidden("MPid", item.MPID)%>
                    <%:Html.Hidden("MPmkguid", item.MPMKGUID)%>
                    <input type="submit" name="submit" value="修改" />
                    <%} %>
                    </td>
                </tr>
            <%} %>
        </tbody>
        <%} %>
    </table>

           
    <br/><br/>　
</div>
<script type="text/javascript">
$(window).load(function(){
	    $('img').each(function(i){
			$(this).removeAttr('width');
			$(this).removeAttr('height');
 
			//取得影像實際的長寬
			var imgW = $(this).width();
			var imgH = $(this).height();
 
			//計算縮放比例
			var w=150/imgW;
			var pre=1;
			if(w<1){
				pre=w;
			}else{
				pre=1;
			}
 
			if(pre!=1){
			    $(this).width(150);
			    $(this).height(imgH*pre);
                }
		});
    });
</script>
</asp:Content>
